Skip to content

fix(tweets): limit publishing of tweets based on date#88

Open
tigranstream wants to merge 3 commits intomainfrom
fix/SLW-597-limit-tweets
Open

fix(tweets): limit publishing of tweets based on date#88
tigranstream wants to merge 3 commits intomainfrom
fix/SLW-597-limit-tweets

Conversation

@tigranstream
Copy link

No description provided.

@tigranstream tigranstream requested review from AVVS and BrRenat May 20, 2021 06:50
this.publish(saved);

// Moment throws: value provided is not in a recognized RFC2822 or ISO format, that's why Date constructor is used.
const tweetDate = moment(new Date(tweet.date));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you show an example of tweet.date?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BrRenat I took an example value from here:
https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/tweet
"created_at": "Wed Oct 10 20:19:24 +0000 2018"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed, however I got some warnings for the specified date:

Deprecation warning: value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JFYI
If you know the format of an input string, you can use that to parse a moment.
moment('24/12/2019 09:15:00', "DD MM YYYY hh:mm:ss");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants